package java920;

//3、使用 * 打印矩形、直角三角形、等腰三角形、菱形图案。
public class Test11 {
    public static void main(String[] args) {
      /*  for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 8; j++) {
                System.out.print("*");
            }
            System.out.println();
        }*/

        /*
         *
 for (int i = 3; i >= 1; i--) {
            for (int j = 1; j <= 4 - i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
         *
         * */

        /*

  int max = 5;
        //控制行数
        for (int i = 1; i <= 5; i++) {
            //控制空格
            for (int j = 1; j <= max - i; j++)
                System.out.print(" ");
            //控制星数
            for (int k = 1; k <= i * 2 - 1; k++)
                System.out.print("*");
            System.out.println();
        }
         * */
        for (int i = 1; i <= 5; i++) {
            //将空格和*分开看，看" "的变化i=1时，它是4，2的时候是3，找规律
            for (int j = 1; j <= 5 - i; j++) {
                System.out.print(" ");
            }
            for (int k = 1; k <= 2 * i - 1; k++) {//找规律，i是 1 3 5 7 9基数
                System.out.print('*');
            }
            //换一行
            System.out.println();
        }
        for (int i = 1; i <= 4; i++) {
            for (int j = 1; j <= i; j++) {//空格 1 2 3 4 so
                System.out.print(" ");
            }
            for (int k = 1; k <= 2 * (4 - i + 1) - 1; k++) {//* 7 5 3 1 倒着来的基数
                System.out.print('*');
            }
            System.out.println();
        }
    }
}
